<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer {
            width: 300px;
            height: 300px;
            background-color: blue;
        }

        .inner {
            width: 150px;
            height: 150px;
            background-color: cadetblue;
        }
    </style>
</head>

<body>
    <button id="button">按钮</button>
    <div class="outer" id="outer">
        <div class="inner"></div>
    </div>
    <a id="link" href="https://www.baidu.com">百度一下</a>
    <form action="">
        <button type="reset">重置按钮</button>
    </form>

    <input type="text" id="account">
    <script>

        account.onkeydown = function (event) {
            event.preventDefault();
            if (event.keyCode == 13) {
                console.log('登录');
            }
        }

        link.onclick = function (event) {
            event.preventDefault();
        }

        outer.onclick = function (event) {
            // console.log(event.target);
            console.log(event.offsetX, event.offsetY);
        }


        button.onclick = function (event) {
            console.log(event.target);
        }
    </script>
</body>

</html>